import request from "@/utils/request";
import {RuleInfoType, RuleInfoPageType} from "@/api/sys/admin/rule-info/types";
import {PATH_SYS_ADMIN} from "@/utils/constant";

const baseUrl = PATH_SYS_ADMIN + '/rule-info/'

/**
 * 查询规则说明列表 - 带分页
 * @param data
 */
export function getRuleInfoListApi(data: PageQuery<RuleInfoType>): PromisePageListType<RuleInfoType> {
    return request.post(baseUrl + 'list', data)
}

/**
 * 通过规则说明id获取规则说明信息
 * @param id
 */
export function getRuleInfoByIdApi(id: number): Promise<RuleInfoType> {
    return request.get(baseUrl + id)
}

/**
 * 修改规则说明
 * @param id
 * @param data
 */
export function editRuleInfoApi(id: number, data: RuleInfoType): Promise<any> {
    return request.patch(baseUrl + id, data)

}

/**
 * 添加规则说明
 * @param data
 */
export function addRuleInfoApi(data: RuleInfoType): Promise<any> {
    return request.post(baseUrl, data)

}

/**
 * 删除规则说明
 * @param id
 */
export function deleteRuleInfoApi(id: number): Promise<any> {
    return request.delete(baseUrl + id)
}